/*
 *  Copyright © 2014 CIB Co.Ltd
 *  * All right reserved
 *  * Auther:jin xingwang
 *
 */

package com.jwts.common;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 功能/模块
 * @author 靳兴旺
 * @version 1.0.0 2020-7-15
 * 用来储存保存到jwt中的信息
 */
public class JwtClaims extends ConcurrentHashMap<String, Object> implements Serializable {
    public JwtClaims (String userId, LocalDateTime localDateTime){
        this.put(USERID, userId);
        this.put(FAILURETIME, localDateTime);
    }

    public JwtClaims (String openId, String userId, LocalDateTime localDateTime) {
        this.put(OPENID, openId);
        this.put(USERID, userId);
        this.put(FAILURETIME, localDateTime);
    }

    public JwtClaims (){
        super();
    }

    /** 微信id */
    private final String OPENID = "openId";

    /** 用户id */
    private final String USERID = "userId";

    /** 有效期 */
    private final String FAILURETIME = "failureTime";

    /**
     * 重写hashcode有效方法
     * @return hashCode
     */
    @Override
    public int hashCode(){
        return Objects.hash(super.hashCode(), this);
    }

}
